<template>
	<view class="pilicy-list" :style="isHome ? 'height:560rpx' : 'min-height:calc(100vh - 108rpx)'">
		<view class="item" v-for="item in list" :key="item.id">
			<pilicy-item  :type="type" :info="item" :showName="showName" @click="handleClick(item)"></pilicy-item>
		</view>
		<!-- <view v-else class="">
			{{list.length}}
			<u-empty text="暂无记录" mode="data"></u-empty>
		</view> -->
	</view>
</template>

<script>
	import PilicyItem from './pilicy-item/PilicyItem.vue'
	export default {
		name: 'PilicyList',
		components: { PilicyItem },
		props: {
			list: {
				type: Array,
				default() {
					return []
				}
			},
			isHome: {
				type: Boolean,
				default: false
			},
			showName: {
				type: Boolean,
				default: false
			},
			//是否超时
			type: {
				type: Boolean,
				default: false
			}
			
		},
		data () {
			return {
				sList: this.list,
				flag: false,
			}
		},
		created() {
			// if (this.isHome) {
			// 	this.flag = true;
			// }
		},
		methods: {
			//点击向父组件发送事件
			handleClick (info) {
				this.$emit('click', info);
			}
		},
		watch: {
			list: {
				handler(newValue) {
					if (Object.keys(newValue).length > 0) {
						this.sList = newValue;
					}
				},
				deep: true
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pilicy-list {
		padding: 30rpx;
		width: 710rpx;
		// height: calc(100vh - 106rpx);
		// overflow-y: auto;
		// min-height: 686rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
	}
	
	.item {
		border-bottom: 1px solid #E5E5E5;
		margin-bottom: 30rpx;
		&:nth-last-child(1) {
			border: none;
		}
	}
</style>
